package main

import (
    "database/sql"
    "fmt"
    "log"
)
func main() {
    db,_ := sql.Open("mysql", "gcore:gcore@tcp(192.168.200.248:3306)/test?charset=utf8")
    result, _ := db.Exec("INSERT INTO userinfo (username, departname, created) VALUES (?, ?, ?)","lily","销售","2016-06-21")
    id, err := result.LastInsertId()
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(id)
}